using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class LightHide : MonoBehaviour
{
    private PlayerController player => GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerController>();
    
    public void InteractAction()
    {
        if (player.canLightHide)
        {
            //TODO:相关变化，不能跳跃，速度减慢
            player.speed = Settings.hideSpeed;
            player.canJump = false;
            player.canLightHide = false;
            player.isLightHide = true;
        }
        else
        {
            player.speed = Settings.playerSpeed;
            player.canJump = true;
            player.canLightHide = true;
            player.isLightHide = false;
        }
    }

    private void Update()
    {
        if (player != null && player.isLightHide) transform.position = player.transform.position;
    }
}